﻿<UserControl x:Class="WpfPdfReader.RecentItemControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="600" Opacity="0.8">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="34"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal" Background="Green" PreviewMouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
            <Image Margin="3,1" Source="images/Open32.png"/>
            <Label  Background="Green" FontWeight="Bold" FontSize="18" Foreground="White" Content="最近浏览的文件"/>
        </StackPanel>
        <ListView Grid.Row="1" Name="listView" SelectionChanged="listView_SelectionChanged">   
            <ListView.ItemTemplate>
                <DataTemplate >
                    <DataTemplate.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="FontSize" Value="16"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </DataTemplate.Resources>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="560"/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.ToolTip>
                            <ToolTip FontSize="14" FontFamily="Arial" Background="Green" Foreground="White">
                                <StackPanel>
                                    <!--<TextBlock Text="{Binding FullName}"/>-->
                                    <Image Margin="3" Source="{Binding TitlePageBmpPath}" RenderOptions.BitmapScalingMode="NearestNeighbor" Stretch="Uniform"/>
                                </StackPanel>
                            </ToolTip>
                        </Grid.ToolTip>
                        <StackPanel Grid.Column="0" Orientation="Horizontal">
                            <Image Source="images/Favorites.png"/>
                            <TextBlock Text="{Binding Name}"/>
                        </StackPanel>
                        <TextBlock Grid.Column="1" Text="{Binding Time}"/>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
            <ListView.Resources>
                <Style TargetType="ListViewItem">
                    <Setter Property="Height" Value="32"/>
                    <Style.Triggers>
                        <EventTrigger RoutedEvent="Mouse.MouseEnter">
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Duration="0:0:0.1" Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" To="LightGreen"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="Mouse.MouseLeave">
                            <EventTrigger.Actions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Duration="0:0:0.1" Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" To="Transparent"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                    </Style.Triggers>
                </Style>
            </ListView.Resources>
            
        </ListView>
    </Grid>
</UserControl>
